      *> File Name     000003_Enums.cbl.
      *> Description   Defining and using enumerations.
      *> Project Type  Console Application.
      *> CodePlex URL  http://cobol.codeplex.com
 
       program-id.   Main.
       repository.
           class sys-console as "System.Console"
           enum  months      as "Months"
           enum  colors      as "Colors"
           .
       working-storage section.
       01  month  months.
       01  color  colors.
       procedure division.
           move "Using Enumerations" to sys-console::"Title"
 
           set month to months::"January"
           display "Month: " month
 
           set color to colors::"Blue" b-or colors::"Green"
           display "Color: " color
 
           display "Press any key to continue . . . " no advancing
           invoke sys-console::"ReadKey"(true)
           .
       end program   Main.
 
       enum-id.      Months.
       working-storage section.
       01  binary-long.
       78  January value 1.
       78  February.
       78  March.
       78  April.
       78  May.
       78  June.
       78  July.
       78  August.
       78  September.
       78  October.
       78  November.
       78  December.
       end enum      Months.
 
       enum-id.      Colors.
       class-attributes.
           custom-attribute is type "System.FlagsAttribute".
       working-storage section.
       01  binary-long.
       78  Red     value 0.
       78  Orange  value 1.
       78  Yellow  value 2.
       78  Green   value 4.
       78  Blue    value 8.
       78  Purple  value 16.
       end enum      Colors.